﻿@using SF.Web.Navigation
@model NavigationViewModel
@if ((Model.TempNode != null) && (Model.HasVisibleChildren(Model.TempNode)))
{
    <ul role="menu">
        @foreach (var childNode in Model.TempNode.Children)
        {
            if (!Model.ShouldAllowView(childNode)) { continue; }

            if (!Model.HasVisibleChildren(childNode))
            {
                <li role="presentation" class='@Model.GetClass(childNode.Value)'><a aria-selected='@Model.IsCurrentNode(childNode.Value)' href="@Url.Content(Model.AdjustUrl(childNode))">@Html.Raw(Model.GetIcon(childNode.Value))@Model.AdjustText(childNode)</a></li>
            }
            else
            {
                <li role="presentation" class='@Model.GetClass(childNode.Value)'>
                    <a aria-selected='@Model.IsCurrentNode(childNode.Value)' href="@Url.Content(Model.AdjustUrl(childNode))">@Html.Raw(Model.GetIcon(childNode.Value))@Model.AdjustText(childNode)</a>
                    @Model.UpdateTempNode(childNode)@Html.Partial("NavigationNodeChildTreePartial", Model) @* recursion *@
                </li>
            }
        }
        </ul>
}